import { IRequestOptions } from './types/types';

export const defaultReqParams: IRequestOptions = {
  ignoreErrorToast: false,
  showLoading: false,
  deleteEmptyParam: true,
  ignoreCancel: false,
};

/**
 * 需要重新登录的code
 */
export const authorityFailureCodes = ['120001', '120002', '120003', '120010', '10020302', '10020301'];

// 响应状态
export const responeStatus = {
  SUCCESS: 'SUCCESS',
  ERROR: 'ERROR',
};

export const deleteEmptyParams = (params: Record<string, unknown>) => {
  for (const k in params) {
    const value = params[k];
    if (value === '' || value === null || value === undefined) {
      delete params[k];
    }
  }
};
